package yt.kpool.activity.salesman;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import org.greenrobot.eventbus.EventBus;

import butterknife.ButterKnife;
import butterknife.OnClick;
import yt.kpool.MainActivity;
import yt.kpool.R;
import yt.kpool.activity.personal.LoginActivity;
import yt.kpool.activity.setting.AboutUsActivity;
import yt.kpool.activity.setting.AccountListActivity;
import yt.kpool.activity.setting.ChangeActivity;
import yt.kpool.activity.setting.FastLookListActivity;
import yt.kpool.activity.setting.PaySetAc;
import yt.kpool.activity.setting.PoliceSet;
import yt.kpool.activity.setting.agent.AgentAc;
import yt.kpool.base.BaseApplication;
import yt.kpool.util.SPUtil;
import yt.kpool.util.TitleControl;
import yt.kpool.view.dialog.LoadingDialog;

/**
 * 业务员设置
 */
public class SalesmanSettingActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_salesman_setting);
        ButterKnife.bind(this);
        initTitle();
    }

    private void initTitle() {
        TitleControl titleControl = new TitleControl(this);
        titleControl.setTitle("设置");

    }
    /**
     * 点击事件的处理
     *
     * @param view
     */
    @OnClick({ R.id.ly_safe, R.id.ly_about_us, R.id.tv_exit})
    public void onClick(View view) {
        switch (view.getId()) {


            case R.id.ly_safe://修改密码
                startActivity(new Intent(SalesmanSettingActivity.this, ChangeActivity.class));
                break;


            case R.id.ly_about_us://关于我们
                startActivity(new Intent(SalesmanSettingActivity.this, AboutUsActivity.class));
                break;
            case R.id.tv_exit://退出
                //业务员

                SPUtil spUtil=new SPUtil(BaseApplication.context, BaseApplication.FILENAME);
                spUtil.remove(BaseApplication.TOKEN);
                spUtil.remove(BaseApplication.UserType);
                spUtil.remove(BaseApplication.NAME);
                spUtil.remove(BaseApplication.ID);
                Intent intent = new Intent(SalesmanSettingActivity.this, MainActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
                break;

        }
    }
}
